<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
            .box1{
             width: 200px;
             height: 100px;
             background-color: aqua;   
            }
    </style>
</head>
<body>
    <button id="btn">点</button>
    <hr />
    <div class="box1">
        
    </div>
<script>

    // 点击按钮后,能修改box1的高宽颜色
        // 先获取元素
        const box1 = document.querySelector("div.box1")
        console.log(box1);
        const btn = document.getElementById("btn")
        console.log(btn);
        btn.addEventListener("click",function(){

            /* 
            修改box1的样式
            方法:   
                元素.style.样式名 = 样式值
                如果样式中含有-,则需要将样式修改为驼峰令名法
                background-color -> backgroundColor
            */
            box1.style.width  = "400px"
            box1.style.height = "400px"
            box1.style.backgroundColor = "yellow"
        })
</script>
</body>
</html>